import json


def json_write(path, info_dict):
    """
    写入，
    :return:
    """
    # 将字典写入JSON文件
    with open(path, 'w', encoding='utf-8') as f:
        json.dump(info_dict, f, ensure_ascii=False)


def json_read(path):
    """
    :param phones_info_path:
    :return:
    """
    # 使用json.load()函数读取文件并将其转换为字典
    with open(path, 'r', encoding='utf-8') as file:
        data = json.load(file)
    return data


def text_write(path, message):
    # 打开文件进行写入，使用'utf-8'编码
    with open(path, 'w', encoding='utf-8') as file:
        # 写入Unicode字符串
        file.write(message)


def text_read(path):
    # 打开文件进行读取，使用'utf-8'编码
    with open(path, 'r', encoding='utf-8') as file:
        # 读取文件内容
        content = file.read()
    return content
